<?php
namespace addons\auxiliary\Model;
use Think\Model;
class AuxiliaryCollection extends Model{
	/*自动完成*/
	protected $_auto = array(
		array('uid','session',self::MODEL_INSERT,'function','user_auth.uid'),
		array('aid','getAid',self::MODEL_INSERT,'callback'),
		array('url','getUrl',self::MODEL_INSERT,'callback'),
		array('start_time','time',self::MODEL_INSERT,'function'),
	);

	/*获取AID*/
	protected function getAid(){
		return input('get.aid');
	}

	/*获取URL*/
	protected function getUrl(){
		return session('__PREV__').'/aid/'.$this->getAid();
	}

	/*获取TypeD*/
	protected function getType(){
		return input('get.type');
	}

	//获取我的收藏
	public function AndMe($uid , $order = 'id desc'){
		$map = array('uid'=>$uid);
		$count = $this->where($map)->count();
		$page = new \Think\Page($count,config('FRONT_LIST_ROWS'));
		$data['list'] = $this->where($map)->limit($page->firstRow,$page->listRows)->order($order)->select();
		$data['page'] = $page->show();
		return $data;
	}
}